/*
 * RpcServer.h
 *
 *  Created on: Nov 6, 2015
 *      Author: rpi
 */

#ifndef RPCSERVER_H_
#define RPCSERVER_H_

#include <thread>
#include <jsonrpc.h>

template <typename T>
class RpcServer
{
public:
	RpcServer(std::string strIpAddr, unsigned short usPort);
	virtual ~RpcServer();
private:
	void initialize();
	void finalize();

	T _oRpcObj;
	Json::Rpc::TcpServer _tcpServer;
	std::thread *_pthdServer;
	bool _blStop;
	void addRpcMethod(std::string func);

	static void runRPCServer(void *pParam);
};

#endif /* RPCSERVER_H_ */
